<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
.father {
  width: 300px;
  height: 300px;
  background-color: pink;
}

.son {
  width: 100px;
  height: 100px;
  margin: 20px 20px;
  background-color: green;
}

</style>
<body>
    <div id="app">
      <h3>事件修饰符</h3>
      <!-- @事件名.prevent  使用较少-->
      <a @click.prevent href="http://www.baidu.com">去百度</a>
      
      <!-- @事件名 -->
      <div class="father" @click="fatherFn">
        <!-- .stop 阻止冒泡  相对而言重要一些 -->
        <div class="son" @click.stop="sonFn">
          儿子
        </div>
      </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          
        },
        methods: {
          sonFn() {
            console.log('他是儿子');
          },
          fatherFn() {
            alert('他是爸爸')
          }
        }
      })
    </script>
</body>
</html>